import request from '@/utils/request'
import { getRefreshToken } from '@/utils/auth'
import common from '@/assets/js/common.js'
import service from '@/utils/request'

// 获得角色分页
export function listRole(params) {
    return request({
      url: common.base64DeCode('46AA5800B519A2B623BBA5E845AF80832CB9C2F0D4CF58C62FCF6EF57E200F97'), //  /system/role/page
      method: 'get',
      params
    })
}
/** 
 * 获取指定部门及下级部门已经下级部门的用户
 * @param {object} params 管理后台 - 部门列表 Request VO
 * @param {string} params.name 部门名称,模糊匹配
 * @param {number} params.status 展示状态,参见 CommonStatusEnum 枚举类
 * @param {number} params.parentId 父部门 ID
 * @param {boolean} params.relevance 是否需要返回本部门及下级部门
 * @returns
 */
export function getSimpleDeptUserList(data) {
  return request({
    url: common.base64DeCode('787C989B5DB31035A5B028AEB462574809F27341FE74F8011CA94F7CEE3F75A38B1DF2D9FAB547D1E8E80392BAA0F6F1'), //  /system/dept/list-dept-user-simple
    method: 'post',
    data
  })
}
/** 
 * 获得指定角色下的用户可见范围
 * @param {string} roleId 角色编号
  * @returns
 */
export function getAssignDeptUserList(data) {
  return request({
    url: common.base64DeCode('787C989B5DB31035A5B028AEB4625748976F4ACA26DEFDF8DB3D2D96F34DA5E71F6E9B44207CB4205B976FECF96DAEC5'), //  /system/dept/list-role-dept-user
    method: 'post',
    data
  })
}
/** 
 * 获得角色授权的工号列表
 * @param {string} roleId 角色编号
  * @returns
 */
export function listRoleUsers(params) {
  return request({
    url: common.base64DeCode('E1071D6D944EDAA3712903DF61BCEFDBF81956F053E43B7783D669B1E36FA84D91D93B50C36B43A8EFB2C44D3C1B3308'), //  /system/permission/list-role-users
    method: 'get',
    params
  })
}


/** 
 * 将角色授权给多个工号
 * @param {object} params 管理后台 - 角色授权给多个工号 Request VO
 * @param {number} params.roleId 角色编号
 * @param {array} params.userIds 工号列表
 * @returns
 */
export function assignRoleUsers(data) {
  return request({
    url: common.base64DeCode('E1071D6D944EDAA3712903DF61BCEFDBBC4668118D6199F4AC8EF0C38D4B1AA39795DE432065B7863CB37B0F37AA2487'), //  /system/permission/assign-role-users
    method: 'post',
    data
  })
}


export function updateRoleStatus(data) {
  return request({
    url: common.base64DeCode('0291A5077FFB370176D087AA84FC945D1B01A1E020DEB71A0D9338DA2B402FCF'), //  /system/role/update-status
    method: 'post',
    data
  })
}
export function createRole(data) {
  return request({
    url: common.base64DeCode('6E08BDBE714912930DFC6803C4B1C70C4284BDDDE03632E77ACC9DED034BC50F'), //  /system/role/create
    method: 'post',
    data
  })
}

export function updateRole(data) {
  return request({
    url: common.base64DeCode('0291A5077FFB370176D087AA84FC945D738E086FA647FCAD246E34051147DB64'), //  /system/role/update
    method: 'post',
    data
  })
}
//删除
export function delRole(params) {
  return request({
    url: common.base64DeCode('5293359B1BB00051D2ED2D6D8E974C7972A6086A5FD6444D2627689719A61A75'), //  /system/role/delete
    method: 'get',
    params
  })
}
//获得角色信息
export function getRole(params) {
  return request({
    url: common.base64DeCode('EDDB80F6815179A999A9F9343C8B40FE13FA7CB244EFDD78189ED4B991CC2E38'), //  /system/role/get
    method: 'get',
    params
  })
}

//获取角色详细配置信息

export function roleConfig(params) {
  return request({
    url: common.base64DeCode('E1071D6D944EDAA3712903DF61BCEFDBDBB9765C05B6DCB9138C3B3E452026FF'), //  /system/permission/role-config
    method: 'get',
    params
  })
}

//对象授权
export function listDeptUsers(params) {
  return request({
    url: common.base64DeCode('E1071D6D944EDAA3712903DF61BCEFDB13146C829E368562C5DCD0F4293EE0ADC49FAFF12CE615F14A9706CD8B235C09'), //  /system/permission/list-dept-users
    method: 'get',
    params
  })
}

export function roleempower(params) {
  return request({
    url: common.base64DeCode('E1071D6D944EDAA3712903DF61BCEFDBA2ECE3EF634EA9DAAEE61B0CA0E8628C'), //  /system/permission/role-empower
    method: 'get',
    params
  })
}




// 权限


export function roleconfig(params) {
  return request({
    url: common.base64DeCode('E1071D6D944EDAA3712903DF61BCEFDBDBB9765C05B6DCB9138C3B3E452026FF'), //  /system/permission/role-config
    method: 'get',
    params
  })
}
/** 
 * 获取角色功能列表
 * @param {object} params 角色功能授权信息
 * @param {number} params.roleId 角色ID
 * @param {number} params.label 系统标识 1-业务平台 2-管控平台
 * @param {number} params.functionId 功能ID
 * @returns
 */
export function getRoleFunctionAuthority(data) {
  return request({
    url: common.base64DeCode('E1071D6D944EDAA3712903DF61BCEFDB1E4436D2FA09E980BA453E9F32C1413022DD46E92269899BCC314379C9703D67'), //  /system/permission/role-function-authority
    method: 'post',
    data
  })
}


export function getRoleDataScope(data) {
  return request({
    url: common.base64DeCode('E1071D6D944EDAA3712903DF61BCEFDB0C8ADE56F9741CC7E77F9ADE1457074C547387DD6C72C005DAB16DEAAE51FB8C'), //  /system/permission/assign-role-menu
    method: 'post',
    data
  })
}

export function genCode(data) {
  return request({
    url: common.base64DeCode('4F8D3CD57EC8723D6BDD5DF4D212BFB5EB454D623DFADD56BDC8E7F0B9C84A64'), //  /system/code-info/gen-code
    method: 'post',
    data
  })
}






